//
//  ProjectDefine.h
//  WiFiProject
//
//  Created by JianWei Chen on 17/2/6.
//  Copyright © 2017年 JianWei Chen. All rights reserved.
//

/*
 系统全局宏调用
 需要全局多个地方调用的宏整理到这里
 */

#ifndef ProjectDefine_h
#define ProjectDefine_h
#ifdef __OBJC__
/*
 常见并经常使用的宏
 */
#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height
#define GetViewWidth(view)    view.frame.size.width
#define GetViewHeight(view)   view.frame.size.height
#define GetViewX(view)        view.frame.origin.x
#define GetViewY(view)        view.frame.origin.y
#define StatusbarHeight       (20.f)
#define NavigationbarHeight   (44.f)
#define TabBarHeight          (49.f)
#define MAIN(block) dispatch_async(dispatch_get_main_queue(),block) //主函数调用

//NSUserDefaults
#define SAVE_OBJECT(object,key) {[[NSUserDefaults standardUserDefaults] setObject:object forKey:key] ; [[NSUserDefaults standardUserDefaults]synchronize];}
#define SAVE_BOOL(value,key) {[[NSUserDefaults standardUserDefaults] setBool:value forKey:key] ; [[NSUserDefaults standardUserDefaults]synchronize];}
#define EXRACT_OBJECT(key)        [[NSUserDefaults standardUserDefaults] objectForKey:key]
#define EXRACT_BOOL(key) [[NSUserDefaults standardUserDefaults]boolForKey:key]
#define REMOVE_OBJECT(key)   [[NSUserDefaults standardUserDefaults]removeObjectForKey:key]


//Navgation
#define SystemVersionIOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0 ? YES : NO)


#ifdef SystemVersionIOS7
#define BASE_TEXTSIZE(text, font) ([text length] > 0 ? [text sizeWithAttributes:@{NSFontAttributeName:font}] : CGSizeZero)
#else
#define BASE_TEXTSIZE(text, font) ([text length] > 0 ? [text sizeWithFont:font] : CGSizeZero)
#endif




#define pxScaleHeight(px)     (((px)/1920.f) * SCREEN_HEIGHT)
#define pxScaleWidth(px)     (((px)/1080.f) * SCREEN_WIDTH)

#define BLUTOOTH @"BLUTOOTH"
#define ISPASSWORD @"ISPASSWORD"

/*
 网络库常用宏
 */

//用户资料
#define USERINFO @"userInfo"
#define DTUID @"DTUID"
#define TOKEN @"TOKEN"
#define USERNAME @"USERNAME"    //将登录帐号存储到UserDefault时用
#define PASSWORD @"PASSWORD"    //将登录密码存储到UserDefault时用
#define LOGIN @"LOGIN"          //判断是否登录过
#define VERSION @"1.0"          //版本

#define RegistrationID @"RegistrationID"
#define MAC   [UIDevice currentDevice].identifierForVendor.UUIDString
//注册成功
#define NOTIFY_REGISTER_SUCCESS @"NOTIFY_REGISTER_SUCCESS"
/*
 正测环境切换
 */
#define SanBox 0
#if SanBox

#define kMQTTServerHost @""
#define ServerURL @"http://120.24.55.58:8083/index.php"
#define TYPEID @"2485"   //智能门锁
#define TYPEID2 @"2293"  //平移门
#define TYPEID3 @"2257"  //入户门
#define DTCloudKitAppId @"50095"
#define DTCloudKitAppKey @"pm6BWNPUFHoaAxJl79HtKVcfbUX56CHm"

#else

#define kMQTTServerHost @""
#define ServerURL @"http://api.ourslinks.com/index.php"
#define TYPEID @"2705"   //智能门锁
#define TYPEID2 @"2706"  //平移门
#define TYPEID3 @"2707"  //入户门
#define DTCloudKitAppId @"50203"
#define DTCloudKitAppKey @"9xKRPjlzNPpSXlZAtW1I1gXTUfanxBcw"

#endif

//存放上传头像的路径
#define uploadImagePath [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0] stringByAppendingPathComponent:[NSString stringWithFormat:@"uploadImage.png"]]
//项目宏
#define kspaceWidth (10.f)



#define MAX_CAMERA_LIMIT 10


/*
 项目使用宏，注意顺序别乱
 */
//获取DocumentPATH的文件
#define DocumentPATHFile(filename) [[NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES) lastObject]stringByAppendingPathComponent:filename]

#endif
#endif /* ProjectDefine_h */
